package org.bit.lesson02;

public class Demo204 {
    public static void main(String[] args) {
        Thread thread = new Thread(() -> {
            while (true) {
                System.out.println("hello thread...");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        // 设置为后台线程
//        thread.setDaemon(true);
        // 启动
        thread.start();
        System.out.println("线程是否存活："+thread.isAlive());
        System.out.println("main方法执行完成");
    }
}
